﻿/*
 *Copyright (C), 2006-2009, Sunrise Tech. Co., Ltd.
 *SUNRISE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * 
 * Created on 2007-11-29
 */
package com.mindao.app.survey.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.mindao.app.common.spring.model.BaseModel;

/**
 * 
 * 功能说明:调查访谈表
 * 
 * @author liguocai
 */
@Entity
@Table(name = "sv_survey_conf")
public class SurveyConf extends BaseModel implements Serializable  {
 
	
	public static final int TYPE_OPEN = 1;
	public static final int TYPE_ASSIGN =2 ;	
	public static final int TYPE_wEIXIN = 3;
	//提交人id
	private Long submiter;
	//提交日期
	private Date submitDate;
	
	// 调查主题
	private String subject;
	// 发起单位
	private String unit;
	
	// 备注
	private String note;	

	private Date startDate;

	private Date endDate;
	//调查对象类型：全部员工、指定对象、微信
	private Integer type;
	/**
	 * 可查看汇总结果的人员的ID
	 */
	private String sumViewerIds;
	/**
	 * 可查看汇总结果的人员姓名
	 */
	private String sumViewerNames;
	/**
	 * 是否发布
	 */
	private Integer ifIssue;
		
	/**
	 * 问题配置项
	 */
	private Set<SurveyItemConf> itemConfSet;


	public String getSubject() {
		return subject;
	}


	public void setSubject(String subject) {
		this.subject = subject;
	}


	public String getUnit() {
		return unit;
	}


	public void setUnit(String unit) {
		this.unit = unit;
	}


	public String getNote() {
		return note;
	}


	public void setNote(String note) {
		this.note = note;
	}


	public Date getStartDate() {
		return startDate;
	}


	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}


	public Date getEndDate() {
		return endDate;
	}


	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}


	public Integer getType() {
		return type;
	}


	public void setType(Integer type) {
		this.type = type;
	}


	public String getSumViewerIds() {
		return sumViewerIds;
	}


	public void setSumViewerIds(String sumViewerIds) {
		this.sumViewerIds = sumViewerIds;
	}


	public String getSumViewerNames() {
		return sumViewerNames;
	}


	public void setSumViewerNames(String sumViewerNames) {
		this.sumViewerNames = sumViewerNames;
	}


	public Integer getIfIssue() {
		return ifIssue;
	}


	public void setIfIssue(Integer ifIssue) {
		this.ifIssue = ifIssue;
	}


	


	public Long getSubmiter() {
		return submiter;
	}

	@OneToMany
	@JoinColumn(name="surveyId")
	public Set<SurveyItemConf> getItemConfSet() {
		return itemConfSet;
	}


	public void setItemConfSet(Set<SurveyItemConf> itemConfSet) {
		this.itemConfSet = itemConfSet;
	}


	public void setSubmiter(Long submiter) {
		this.submiter = submiter;
	}


	public Date getSubmitDate() {
		return submitDate;
	}


	public void setSubmitDate(Date submitDate) {
		this.submitDate = submitDate;
	}
	@Transient
	public String getTypeText() {
		if (this.type==TYPE_OPEN){
			return "所有用户";
		}else if (this.type==TYPE_ASSIGN){
			return "指定用户";
		}else if (this.type==TYPE_wEIXIN){
			return "微信用户";
		}else{
			return "";
		}
	}
	

	 
	
	
	

}
